home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / e_os208 / example5 / example5.asm next >
Assembly Source File  |  1996-06-09  |  3KB  |  80 lines

  1. ;╔══════════════════════════════════════════════════════════════════════════╗
  2. ;║                                                                          ║
  3. ;║ This example show how to use the automatic bank switching with           ║
  4. ;║                                                                          ║
  5. ;║ the SVGA cards                                                           ║
  6. ;║                                                                          ║
  7. ;║ Tabs : 13 21 29 37                                                       ║
  8. ;║                                                                          ║
  9. ;╚══════════════════════════════════════════════════════════════════════════╝
  10.  
  11. Locals
  12. .386
  13. CODE32 SEGMENT PUBLIC PARA 'CODE' USE32
  14. ASSUME  CS:CODE32,DS:CODE32,ES:CODE32
  15.  
  16. INCLUDE ..\RESOURCE\EOS.INC
  17.  
  18. File_Pic1   db '..\data\test640.DLZ',0
  19. Addr_Pic    dd 0
  20.  
  21. Screen      dw ?
  22.  
  23. Sel_Txt     db '    ■ Out of selector !',13,10,36
  24. Vesa_Txt    db '    ■ Mode SVGA not supported or VESA not found !',13,10
  25.             db '      To install a vesa driver, refer to your video card documentation.',13,10,36
  26.  
  27.  
  28. Start32:
  29.             mov ah,Load_Internal_File
  30.             mov edx,O File_Pic1
  31.             Int_EOS                 ; Load the file even if the program isn't
  32.             mov [Addr_Pic],eax      ; Link + Internal Check if the File is present
  33.  
  34.             mov ax,Mode640x480x256  ; Init SVGA Mode
  35.             call Init_Vesa
  36.             jnc NoError_Vesa
  37.  
  38.             mov edx,offset Vesa_Txt
  39.             mov ah,Exit_Error
  40.             Int_EOS
  41. NoError_Vesa:
  42.             call Init_Vesa_Bank     ; Turn On the Automatic Bank Switching
  43.             mov [screen],bx
  44.             jnc NoError_Sel
  45.  
  46.             mov edx,offset Sel_Txt
  47.             mov ah,Exit_Error
  48.             Int_EOS
  49. NoError_Sel:
  50.             mov esi,[Addr_Pic]      ; Set palette
  51.             add esi,10              ; Header offset of SCX
  52.             mov dx,3c8h
  53.             xor al,al
  54.             out dx,al
  55.             mov ecx,256*3
  56.             inc dl
  57.             cli
  58. @@again:    outsb                   ; rep outsb do not work with all cards
  59.             loop @@again
  60.             sti
  61.  
  62.             push es                 ; Display picture
  63.             mov es,[screen]
  64.             xor edi,edi
  65.             mov ecx,(640/4)*480
  66.             rep movsd
  67.             pop es
  68.  
  69.             xor ah,ah               ; Wait a key
  70.             DosInt 16h
  71.  
  72.             call Close_Vesa_Bank    ; Turn Off the Automatic Bank Switching
  73.  
  74.             mov ax,4c00h
  75.             int 21h                 ; Exit with Error Code 0
  76.                                     ; and Automaticly restore video Mode !!!
  77.  
  78.             CODE32 ENDS
  79.  
  80.             END